<script setup>
import ImageAside from '@/components/image-aside.vue'
import ImageMain from '@/components/image-main.vue'
import { ref } from 'vue'

const ImageAsideRef = ref(null)
//新增图片分类
const onOpenCreate = () => {
  ImageAsideRef.value.onOpenfromDrawer()
}

const ImageMainRef = ref(null)
const onChange = (id) => {
  ImageMainRef.value.loadData(id)
}

//上传图片
const onUploadImages = () => {
  ImageMainRef.value.showDrawer()
}
</script>

<template>
  <el-container class="bg-white rounded">
    <el-header class="image-header">
      <el-button type="primary" size="small" @click="onOpenCreate">新增图片分类</el-button>
      <el-button type="primary" size="small" @click="onUploadImages">上传图片</el-button>
    </el-header>
    <el-container>
      <ImageAside ref="ImageAsideRef" @change="onChange"></ImageAside>
      <ImageMain ref="ImageMainRef"></ImageMain>
    </el-container>
  </el-container>
</template>

<style scoped>
.image-header {
  border-bottom: 1px solid #eee;
  @apply flex items-center;
}
</style>
